class CommentsController < ApplicationController
	 def create
    @product = Product.find(params[:product_id])
    @comment = @product.comments.create(comment_params)
    redirect_to store_index_path
  end

  	def destroy
		@comment = Comment.find(params[:id])
		@comment.destroy
		flash[:success] = "Comment deleted"
		redirect_to request.referrer || root_url
	end

  private
    def comment_params
      params.require(:comment).permit(:commenter, :body)
    end
end
